package com.demo.gulimall.seckill.controller;

import com.demo.gulimall.common.utils.R;
import com.demo.gulimall.seckill.service.SeckillService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author Chen Yuan
 * @create 2023-08-08  10:04
 */
@Slf4j
@RestController
@RequestMapping("/seckill")
public class SeckillController {

	@Autowired
	private SeckillService seckillService;

	@PostMapping("/kill")
	public R seckill(@RequestParam("killId") String killId,
	                 @RequestParam("code") String code,
	                 @RequestParam("num") Integer num,
	                 @RequestParam("userId") Long userId){
		String orderSn = seckillService.kill(killId, code, num, userId);

		return R.ok();
	}
}
